Dynomotion

Group: DynoMotion Message: 14950 From: tmday7 Date: 8/20/2017
Subject: Manual Toolchange with pause
Hello,
 My mill does not have a tool changer yet so i need to do manual tool changes. Currently i just add a M00 or M01 after tool change in my gcode so gcode/machine will wait for me to change tools.

Is it safe to have M6 execute a C program to do a M01 or is there a better method?

Thanks,
Troy


Group: DynoMotion Message: 14951 From: Tom Kerekes Date: 8/20/2017
Subject: Re: Manual Toolchange with pause

Hi Troy,

No, KMotionCNC doesn't support nested GCode (GCode calls an Action that in invokes GCode).

Other approaches could include:

#1 - have the M6 command to KMotionCNC a PC_COMM_HALT_NEXT_LINE

#2 - display a message box to the operator to prompt him/her to load the tool then press OK to continue or Cancel to Halt.

HTH

Regards

TK


On 8/20/2017 10:07 AM, tmday88@... [DynoMotion] wrote:
 

Hello,
 My mill does not have a tool changer yet so i need to do manual tool changes. Currently i just add a M00 or M01 after tool change in my gcode so gcode/machine will wait for me to change tools.

Is it safe to have M6 execute a C program to do a M01 or is there a better method?

Thanks,
Troy



Group: DynoMotion Message: 14953 From: cnc_machines Date: 8/21/2017
Subject: Re: Manual Toolchange with pause
I am curious about how you would display a message box. Is there an old post on how to do this?
Group: DynoMotion Message: 14955 From: Tom Kerekes Date: 8/21/2017
Subject: Re: Manual Toolchange with pause

See the MessageBox.c example.

Regards

TK


On 8/21/2017 3:33 PM, cnc_machines@... [DynoMotion] wrote:
 

I am curious about how you would display a message box. Is there an old post on how to do this?


Group: DynoMotion Message: 14966 From: tmday7 Date: 8/26/2017
Subject: Re: Manual Toolchange with pause
Tom,
 How do i use this? I tried to make a c program and have M6 execute it , but its not working.
Troy
Group: DynoMotion Message: 14968 From: Tom Kerekes Date: 8/27/2017
Subject: Re: Manual Toolchange with pause

Hi Troy,

Post your C Program, how it was configured, and tell us how and what happened when you invoked it and we can review it.

Regards

TK


On 8/26/2017 3:26 PM, tmday88@... [DynoMotion] wrote:
 

Tom,
 How do i use this? I tried to make a c program and have M6 execute it , but its not working.
Troy


Group: DynoMotion Message: 14977 From: tmday7 Date: 8/31/2017
Subject: Re: Manual Toolchange with pause
Hi Tom,
 The c program is executed from the Tool Setup Screen when a M6 is executed in gcode.
When an M6 is executed in Gcode nothing happens. The Gcode continues to run.

Here is the C code.

#include "KMotionDef.h"

main()
{
PC_COMM_HALT_NEXT_LINE;
}
Group: DynoMotion Message: 14978 From: Tom Kerekes Date: 8/31/2017
Subject: Re: Manual Toolchange with pause

Hi Troy,

If you look up how that symbol is defined in PC-DSP.h it is just a numeric code of 36.

#define PC_COMM_HALT_NEXT_LINE 36  // Stop Application at the Next Line of code

So when KMotionCNC is sent a command of 36 it will Halt on the next line.  But your program doesn't send the code anywhere.

That is something a bit odd with C Programming.  And the source of many mistakes/bugs.  It assumes you know what you are doing and allows ANY valid expression.  For example:

2+2;

Will cause the compiler to compute the value of 4 and do nothing with it so there is really no point. 

4;

Would similarly compute a value of 4 and do nothing with it.  Your code is effectively:

36;

So nothing happens.  Sometimes computing expressions have side effects so it does makes sense to have them.

We have a function available called DoPC that can send a code to the PC (in this case KMotionCNC) to request it to do something.  Maybe "send" is the wrong word.  Rather it places it in a special variable that KMotionCNC periodically polls to see if it has any requests to do anything.  The DoPC function is in the KflopToKMotionCNCFunctions.c file.  So if you include it in your program then you can use it to "send" the code to KMotionCNC.

#include "KMotionDef.h"

#define TMP 10 // which spare persist to use to transfer data
#include "KflopToKMotionCNCFunctions.c"

main()
{
    DoPC(PC_COMM_HALT_NEXT_LINE);
}


HTH
Regards
TK



On 8/31/2017 8:07 AM, tmday88@... [DynoMotion] wrote:
 

Hi Tom,
 The c program is executed from the Tool Setup Screen when a M6 is executed in gcode.
When an M6 is executed in Gcode nothing happens. The Gcode continues to run.

Here is the C code.

#include "KMotionDef.h"

main()
{
PC_COMM_HALT_NEXT_LINE;
}


Group: DynoMotion Message: 14985 From: tmday7 Date: 9/2/2017
Subject: Re: Manual Toolchange with pause
Hi Tom,
 Sorry late replying, got a new work schedule,trying to get adjusted.

" It assumes you know what you are doing..." And i definately dont know what iam doing in the c code world. :)

Your program works great.Also added a pop up message to Change Tool.
 I first tried to have an action to only Execute the ccode during an M6, but Gcode would not stop till about 3 or 4 lines later. So i changed action to Exec/Wait for M6 and all seems good now.


Thanks again,
Troy
Group: DynoMotion Message: 15011 From: tmday7 Date: 9/8/2017
Subject: Re: Manual Toolchange with pause
Hi Tom,
 The C Code is working when running G code. But now when i edit the tool library, say a tool diameter, and exit tool library, i get my pop up message i added to c code to change tool.
Any way to prevent this?

BTW, 5 axis video looks nice. I need to get on designing my trunnion table. :)

Thanks,
Troy
Group: DynoMotion Message: 15013 From: Tom Kerekes Date: 9/8/2017
Subject: Re: Manual Toolchange with pause

Hi Troy,

There is an option in Tool Setup | Trajectory Planner | M6 on Tool Table Changes that you can turn off.

Yes would love to see your post on developing a Trunnion Table.

Regards

TK


On 9/8/2017 9:02 AM, tmday88@... [DynoMotion] wrote:
 

Hi Tom,
 The C Code is working when running G code. But now when i edit the tool library, say a tool diameter, and exit tool library, i get my pop up message i added to c code to change tool.
Any way to prevent this?

BTW, 5 axis video looks nice. I need to get on designing my trunnion table. :)

Thanks,
Troy